package com.htgd.gardenexpo.service.impl;

import com.htgd.gardenexpo.entity.GeConGisresourceUpload;
import com.htgd.gardenexpo.dao.GeConGisresourceUploadDao;
import com.htgd.gardenexpo.service.GeConGisresourceUploadService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (GeConGisresourceUpload)表服务实现类
 *
 * @author makejava
 * @since 2021-07-20 14:18:05
 */
@Service("geConGisresourceUploadService")
public class GeConGisresourceUploadServiceImpl implements GeConGisresourceUploadService {
    @Resource
    private GeConGisresourceUploadDao geConGisresourceUploadDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public GeConGisresourceUpload queryById(Integer id) {
        return this.geConGisresourceUploadDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<GeConGisresourceUpload> queryAllByLimit(int offset, int limit) {
        return this.geConGisresourceUploadDao.queryAllByLimit(offset, limit);
    }

    @Override
    public List<GeConGisresourceUpload> queryByGisId(int id) {
        return this.geConGisresourceUploadDao.queryByGisId(id);
    }

    /**
     * 新增数据
     *
     * @param geConGisresourceUpload 实例对象
     * @return 实例对象
     */
    @Override
    public GeConGisresourceUpload insert(GeConGisresourceUpload geConGisresourceUpload) {
        this.geConGisresourceUploadDao.insert(geConGisresourceUpload);
        return geConGisresourceUpload;
    }

    /**
     * 修改数据
     *
     * @param geConGisresourceUpload 实例对象
     * @return 实例对象
     */
    @Override
    public GeConGisresourceUpload update(GeConGisresourceUpload geConGisresourceUpload) {
        this.geConGisresourceUploadDao.update(geConGisresourceUpload);
        return this.queryById(geConGisresourceUpload.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.geConGisresourceUploadDao.deleteById(id) > 0;
    }

    @Override
    public boolean deleteByGisId(Integer id) {
        return this.geConGisresourceUploadDao.deleteByGisId(id) > 0;
    }

    @Override
    public boolean deleteByIds(String[] id,int gid) {
        return this.geConGisresourceUploadDao.deleteByIds(id,gid) > 0;
    }

    @Override
    public void deleteNotById(Integer uploadIds, Integer gisId) {
        geConGisresourceUploadDao.deleteNotById(uploadIds,gisId);
    }
}
